package com.aaa.util;

import com.aaa.dao.UserDao;
import com.aaa.entity.User;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @BelongsPackage: com.aaa.util
 * @Description:
 * @CreateTime: 2023-03-29  19:04
 * @Author: ql
 */
@Component
public class AccountName {

    @Autowired
    private UserDao userDao;

    public String getAccountName(){
        String phone = WebGetUser.UserUtil();
        QueryWrapper<User> wrapper = new QueryWrapper<>();
        wrapper.eq("phone",phone);
        User user = userDao.selectOne(wrapper);
        return user.getUserName();
    }
    public Long getAccountId(){
        String phone = WebGetUser.UserUtil();
        QueryWrapper<User> wrapper = new QueryWrapper<>();
        wrapper.eq("phone",phone);
        User user = userDao.selectOne(wrapper);
        return user.getUserId();
    }
    public User getUser(){
        String phone = WebGetUser.UserUtil();
        QueryWrapper<User> wrapper = new QueryWrapper<>();
        wrapper.eq("phone",phone);
        return userDao.selectOne(wrapper);


    }

}
